package com.golf.core.course.bodies;

import com.golf.core.course.loader.Background;

/**
 * 
 * 
 * @author gareth
 */
public abstract class AbstractCourseBody implements CourseBody
{

    /** The name of this body. */
	private final String name;

	/** The physics engine id for this body - hack as engine allows setting a name, but you cant get at it only the id !!!!!!! */
	private int id;
	
	/** The background associated with this body. */
	private Background background;
	
	
	/**
	 * Create an instance of a course body.
	 * 
	 * @param name The unique name of the body.
	 */
	public AbstractCourseBody(final String name)
	{
		this.name = name;
	}
	
	
	/**
	 * {@inheritDoc}
	 */
	public String name()
	{
		return name;
	}


	/**
	 * 
	 * 
	 * @param background
	 */
	public void setBackground(final Background background) 
	{
		this.background = background;
	}
	
	
	/**
	 * 
	 * 
	 * @return
	 */
	public Background getBackground()
	{
		return background;
	}
	
	
    /**
     * {@inheritDoc}
     */
	public boolean equals(final Object obj)
	{
	    // FIXME: not valid !! good enough for short term.
	    return name.equals(((Ball)obj).name());
	}
	
	
	/**
	 * {@inheritDoc}
	 */
	public int hashCode()
	{
	    return name.hashCode();
	}
	
	public int getId()
	{
	    return id;
	}
	
	public void setId(final int id)
	{
	    this.id = id;
	}
	
}
